export default{
    state: {
      count: 0,
    },
    getters: {
      doubleCount(state) {
        return state.count * 2
      }
    },
    //同步操作
    mutations: {
      add(state) {
        state.count++
      },
      decrease(state) {
        state.count--
      }
    },
    //异步操作或同步
    actions: {
      delayAdd(context) {
        setTimeout(() => {
          context.commit('add');
        }, 1000);
      }
    }
  }